#include <dbg.h>

#include <cassert>
#include <unordered_set>
using namespace std;

class Solution {
public:
    bool hasAllCodes(string s, int k) {
        unordered_set<string> st;
        for (int i = 0; i + k <= s.size(); ++i) {
            st.insert(s.substr(i, k));
        }
        dbg(st);
        return st.size() == 1 << k;
    }
};

int main() {
    Solution s;

    string s1 = "00110110";
    int k1 = 2;
    bool res1 = true;

    string s2 = "0110";
    int k2 = 1;
    bool res2 = true;

    string s3 = "0110";
    int k3 = 2;
    bool res3 = false;

    assert(s.hasAllCodes(s1, k1) == res1);
    assert(s.hasAllCodes(s2, k2) == res2);
    assert(s.hasAllCodes(s3, k3) == res3);

    return 0;
}